package day1026.dem4;



import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @program: fanxing
 * @description:
 * @author: 诸葛龙辰
 * @create: 2022-10-26 20:10
 **/
public class Test {
    public static void main(String[] args) {
       Pig p1=new Pig();
        p1.show(38);
    }
}
/**
 * 这就定义好自定义注解
 */
@Target({ElementType.TYPE,ElementType.METHOD,ElementType.FIELD,ElementType.PARAMETER})
@Retention(RetentionPolicy.SOURCE)
/**
 * @author: 诸葛龙辰
 */
@interface PeiQi1{
    /**
     * 只能写基本数据类型或字符串数组
     * @return
     */
    int aaa()default 38;
    String[]bbb()default {""};
}
@interface pigg{

}
@PeiQi1()
class Pig{
    @PeiQi1
    private String name;

    @PeiQi1
    public void show(@PeiQi1 int age){

        int a = 38;
        System.out.println("~~~~~~~~~~~~~~~~~~"+age);
    }

}

